package com.service;

import com.config.XbConfig;
import com.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Service;

@Service
@EnableConfigurationProperties({User.class})
public class NameServiceImpl {

    @Autowired
    private User user;

    @Autowired(required = false)
    private XbConfig xbConfig;

    public String name(){
        if (xbConfig!=null&&user.isXb()==false){
            return xbConfig.xing()+user.getMingnmae();
        }
        return user.getXingname()+user.getMingnmae();
    }
}
